package com.xiemulei.gulimall.member.web;

import com.xiemulei.common.utils.R;
import com.xiemulei.gulimall.member.feign.OrderFeignClient;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {
    @Resource
    OrderFeignClient orderFeignClient;

    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                  Model model) {
        Map<String, Object> page = new HashMap<>();
        page.put("page", pageNum);
        R r = orderFeignClient.currentUserOrderList(page);
        model.addAttribute("orders", r);
        return "orderList";
    }

}
